#include <stdio.h>
#include <math.h>

#define PD_TABLE_SCALE 250.0f
#define SMALL_PROBABILITY 0.05f

float sigmaD = 0.9f;
float pdTableScalef = PD_TABLE_SCALE;
float tmp = 0.0f;
int pdTableSize = -1;

/* Precomputes the table of values of the probability density pd(z).          */
static
void createPdTable(void){
    int i; 
    float coef = -0.5f/((pdTableScalef*pdTableScalef)*(sigmaD*sigmaD));
    
    printf("pdTableSize: %d\n",pdTableSize);
    printf("<table><tr>\n");
    for (i = 0; i < pdTableSize; i++) 
    	
    	printf("<td style=\"margin: 0px;\"><img style=\"margin: 0px;\" src=\"#\" width=2 height=%d></td>", (int)(exp(coef*(float)(i*i))*500) );

    printf("</tr></table>\n");
}


int main(){
	
    tmp                 = sqrt(-2.0f*sigmaD*sigmaD*log(SMALL_PROBABILITY));
    pdTableSize         = (int)(pdTableScalef*tmp) + 2;

    /*createPdTable();*/


	
	return 0;
}
